package com.zhou.learn.service.impl;

import com.zhou.learn.dao.SpringDataJpaRepository;
import com.zhou.learn.entity.SysUser;
import com.zhou.learn.service.ISpringDataJpaervice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class SpringDataJpaService implements ISpringDataJpaervice {

    @Autowired
    SpringDataJpaRepository springDataJpaRepository;

    @Override
    public Boolean addUser(SysUser user) {
        springDataJpaRepository.save(new SysUser("zhoujuqi", "周举琪", "123456",2, 1));
        springDataJpaRepository.save(new SysUser("chenyu", "陈雨", "123456",1, 1));
        springDataJpaRepository.save(new SysUser("zhaoyx", "赵延雪", "123456",2, 1));
        springDataJpaRepository.save(new SysUser("xuhui", "许慧", "123456",1, 1));
        springDataJpaRepository.save(user);
        return true;
    }
}
